/**
 * 数组分块
 * @param {Array} arr
 * @param {Function} size
 */
export function chunk(arr, size = 1) {
  if (arr.length === 0) {
    return []
  }

  let bigArr = [],
    smallArr = []
  arr.forEach((item) => {
    if (smallArr.length === 0) {
      bigArr.push(smallArr)
    }
    smallArr.push(item)
    if (smallArr.length === size) {
      smallArr = []
    }
  })

  return bigArr
}
